package cn.inbot.shopadmin.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.constraintlayout.widget.ConstraintLayout;

import cn.inbot.shopadmin.R;

/**
 * Created by shisenkun on 2021/5/10.
 */
public class EmptyLayout extends ConstraintLayout {

    private TextView tvTip;
    private ImageView ivEmpty;

    public EmptyLayout(Context context) {
        this(context, null);
    }

    public EmptyLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initEmptyLayout(context, attrs);
    }

    private void initEmptyLayout(Context context, AttributeSet attrs) {
        View.inflate(context, R.layout.layout_empty_view, this);
        tvTip = findViewById(R.id.tvTip);
        ivEmpty = findViewById(R.id.ivEmpty);
    }

    public void setTip(String message) {
        tvTip.setText(message);
    }

    public void setImage(int resId) {
        ivEmpty.setImageResource(resId);
    }

}
